//
//  XuanpianTaocanCell.m
//  XDBaseFrameWork
//
//  Created by xindao on 14-9-28.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "XuanpianTaocanCell.h"

@implementation XuanpianTaocanCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self makeViews];
    }
    return self;
}

- (void)makeViews{
    self.contentView.backgroundColor = [UIColor whiteColor];

    _leftIV = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 60)];
    _leftIV.layer.masksToBounds = YES;
    _leftIV.contentMode = UIViewContentModeScaleAspectFill;
    _leftIV.backgroundColor = UIColorFromRGB(0xeaeaea);
    [self.contentView addSubview:_leftIV];

    _titleLB = [UILabel initLabelText:nil andRect:CGRectMake(VIEW_POINT_MAX_X(_leftIV)+10, 10, 100, 60) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:13] andTextColor:RGBA(48, 44, 39, 1) andTextAlignment:NSTextAlignmentLeft];
    _titleLB.numberOfLines = 0;
    [self.contentView addSubview:_titleLB];

    _subTitleLB = [UILabel initLabelText:nil andRect:CGRectMake(VIEW_POINT_MAX_X(_titleLB)+10, 10, 100, 60) andBackGroudColor:[UIColor clearColor] andTextFont:[UIFont systemFontOfSize:13] andTextColor:RGBA(48, 44, 39, 1) andTextAlignment:NSTextAlignmentRight];
    _subTitleLB.numberOfLines = 0;
    [self.contentView addSubview:_subTitleLB];

    _topLine = [[XDTools sharedXDTools] createSeparatorLineWithRect:CGRectMake(0, 0, UI_SCREEN_WIDTH, .5f)];
    [self.contentView addSubview:_topLine];

    _downLine = [[XDTools sharedXDTools] createSeparatorLineWithRect:CGRectMake(0, 79.5f, UI_SCREEN_WIDTH, .5f)];
    [self.contentView addSubview:_downLine];
}

- (void)getDataWithDict:(NSDictionary *)dict type:(NSString *)type{
    NSString * num = @"";
    if ([type isEqualToString:@"Cover"]) {
        if ([dict[@"CoverHeath"] length]) {
            num = dict[@"CoverCount"];
        }else{
            num = @"0";
        }
        [_leftIV sd_setImageWithURL:[NSURL URLWithString:dict[@"CoverHeath"]] placeholderImage:nil];
        _titleLB.text = dict[@"Covername"];
        _subTitleLB.text = [NSString stringWithFormat:@"已选择%@张/%@张",num,dict[@"CoverCount"]];

    }else if ([type isEqualToString:@"Photo"]) {
        if ([dict[@"Heath"] length]) {
            num = dict[@"PhotoCount"];
        }else{
            num = @"0";
        }
        [_leftIV sd_setImageWithURL:[NSURL URLWithString:dict[@"Heath"]] placeholderImage:nil];
        _titleLB.text = dict[@"name"];
        _subTitleLB.text = [NSString stringWithFormat:@"已选择%@张/%@张",num,dict[@"PhotoCount"]];

    }else{
        if ([dict[@"BackHeath"] length]) {
            num = dict[@"BackCount"];
        }else{
            num = @"0";
        }
        [_leftIV sd_setImageWithURL:[NSURL URLWithString:dict[@"BackHeath"]] placeholderImage:nil];
        _titleLB.text = dict[@"Backname"];
        _subTitleLB.text = [NSString stringWithFormat:@"已选择%@张/%@张",num,dict[@"BackCount"]];
    }

}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
